/**
 * yuntu-inc.com Inc.
 * Copyright (c) 2014-2017 All Rights Reserved.
 */
package com.qianli.user.ro;

import java.io.Serializable;

/**
 * 分页处理
 *
 * @name 分页处理
 * @author liting
 * @version $Id: Paged.java, v 0.1 2017年9月20日 下午4:47:56 liting Exp $
 */
public class Paged<T> extends BaseRO implements Serializable{
    /** TODO: detail description  */
    private static final long serialVersionUID = 6647058435644603898L;
    /**
     * 总数
     */
    private Integer totalCount;
    /**
     * 页大小
     */
    private Integer pageSize = 10;
    /**
     * 当前页
     */
    private Integer currentPage = 1;
    /**
     * 总页数
     */
    private Integer totalPage;
    /**
     * 数据
     */
    private T  data;

    public Paged() {
    }

    public Paged(Integer totalCount, Integer pageSize, Integer currentPage, T data) {
        super();
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.currentPage = currentPage;
        this.data = data;
        this.totalPage = totalCount%pageSize == 0?totalCount/pageSize:(totalCount/pageSize+1);
    }
    public Integer getTotalCount() {
        return totalCount;
    }
    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public Integer getCurrentPage() {
        return currentPage;
    }
    public void setCurrentPage(Integer currentPage) {
        this.currentPage = currentPage;
    }
    public Integer getTotalPage() {
        return totalPage;
    }
    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }
    public T getData() {
        return data;
    }
    public void setData(T data) {
        this.data = data;
    }
    @Override
    public String toString() {
        return "Paged [totalCount=" + totalCount + ", pageSize=" + pageSize + ", currentPage="
               + currentPage + ", totalPage=" + totalPage + ", data=" + data + "]";
    }
}
